#ifndef _SQL_CONF_H_
#define _SQL_CONF_H_

namespace sql_conf {

static char sPragmas[]=
        "PRAGMA synchronous=0;"
        "PRAGMA count_changed=0;"
        "PRAGMA cache_size=5000;"
        "PRAGMA auto_vacuum=0;"
        "PRAGMA temp_store=MEMORY;"
        "PRAGMA legacy_file_format=OFF;"
        "PARGMA foreign_keys=ON;"
        "PRAGMA encoding=\"UTF-8\";";

static char sCreateTables[]=
        "CREATE TABLE Folders"
        "("
        "	FolderID          INTEGER PRIMARY KEY NOT NULL,"
        "	Path              TEXT NOT NULL,"
        "	ParentID          INTEGER,"
        "	"
        "	UNIQUE (Path)"
        ");"
        ""
        "CREATE TABLE Keys"
        "("
        "	KeyID	          INTEGER PRIMARY KEY NOT NULL,"
        "	Folder            INTEGER NOT NULL,"
        "	Name              TEXT NOT NULL,"
        "	DataType          INTEGER NOT NULL,"
        "   DataValue         BLOB NOT NULL"
        "   "
        "   FOREIGN KEY(Folder) REFERENCES Folders(FolderID)"
        ");"

static char sDefaultData[]=
        "BEGIN TRANSACTION;"
        ""
        "INSERT INTO Folders(Path) VALUES('/');"
        ""
        "END TRANSACTION;";

static char sInsertFolder[]=
        "INSERT INTO Folders(Path,ParentID) VALUES(?,?);";

static const int sInsertFolder_Path=1;
static const int sInsertFolder_Parent=2;

static char sInsertKey[]=
        "INSERT INTO Keys(Folder,Name,DataType,DataValue) VALUES(?,?,?,?);";

static const int sInsertKey_Folder=1;
static const int sInsertKey_Name=2;
static const int sInsertKey_DataType=3;
static const int sInsertKey_DataValue=4;

static char sGetFolderID[]=
        "SELECT FolderID FROM Folders WHERE Path=?";

static const int sGetFolderID_Path=1;

static char sGetChildren[]=
        "SELECT FolderID,Path FROM Folders WHERE ParentID=?";

static const int sGetChildren_ParentID=1;

static char sGetKey[]=
        "SELECT KeyID,DataType,DataValue FROM Keys WHERE Folder=? AND Name=?";

static const int sGetKey_Folder=1;
static const int sGetKey_Name=2;

static char sGetKeyNames[]=
        "SELECT Name FROM Keys WHERE Folder=?";

static const int sGetKeyNames_Folder=1;

static char sGetKeys[]=
        "SELECT Name,DataType,DataValue FROM Keys WHERE Folder=?";

static const int sGetKeys_Folder=1;

/*namespace sql_conf*/ }

#endif
